import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86132
 * Date: 2022-04-12
 * Time: 23:24
 */
public class Demo2 {
    public static void main(String[] args) throws FileNotFoundException {
        /*try(OutputStream outputStream=new FileOutputStream("d:/test.txt")) {
            outputStream.write(97);//一个方法写一个字节
            outputStream.write(98);
            outputStream.write(99);
        } catch (IOException e) {
            e.printStackTrace();
        }*/
        try(OutputStream outputStream=new FileOutputStream("d:/test.txt")) {
            byte[] buffer=new byte[]{97,98,99};
            outputStream.write(buffer);//一个方法写多个字节
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
